# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=m4
pkgver=1.4.18
pkgrel=2
pkgdesc="The GNU macro processor"
arch=('i686' 'x86_64')
url="https://www.gnu.org/software/m4"
license=('GPL3')
groups=('base-devel')
depends=('bash' 'gcc-libs' 'msys2-runtime')
install=m4.install
source=(https://ftp.gnu.org/gnu/m4/$pkgname-$pkgver.tar.xz{,.sig}
        m4-1.4.18-msys2.patch)
sha256sums=('f2c1e86ca0a404ff281631bdc8377638992744b175afb806e25871a24a934e07'
            'SKIP'
            'fbdcb59d940cf5eeba79fdf8935bdb04e6c10b69c981d8ca6fa3a8c35b1905cb')
validpgpkeys=('71C2CC22B1C4602927D2F3AAA7A16B4A2527436A')  # Eric Blake <eblake@redhat.com>

prepare() {
  cd ${srcdir}/$pkgname-$pkgver
  patch -p1 -i ${srcdir}/m4-1.4.18-msys2.patch

  autoreconf -fi
}

build() {
  cd ${srcdir}/$pkgname-$pkgver
  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --with-syscmd-shell=/usr/bin/sh
  make
}

check() {
  cd ${srcdir}/$pkgname-$pkgver
  make check
}

package() {
  cd ${srcdir}/$pkgname-$pkgver
  make prefix=${pkgdir}/usr install
}
